package com.example.myzhugezhaofang.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.mvplibrary.adapter.BaseAdapter;
import com.example.mvplibrary.adapter.BaseViewHolder;
import com.example.myzhugezhaofang.R;
import com.example.myzhugezhaofang.bean.KolimagesBean;

import java.util.List;

public class KolimagesAdapter extends BaseAdapter<KolimagesBean.ListnewsBean> {

    /*public onItemListener listener;

    public void setListener(onItemListener listener) {
        this.listener = listener;
    }*/

    public KolimagesAdapter(List<KolimagesBean.ListnewsBean> datas, Context context, int layoutId) {
        super(datas, context, layoutId);
    }

    @Override
    protected void bindData(BaseViewHolder holder, KolimagesBean.ListnewsBean listBean, int position) {
        TextView text1 = holder.getView(R.id.tv_kolimages_1);
        TextView text2 = holder.getView(R.id.tv_kolimages_2);
        TextView text3 = holder.getView(R.id.tv_kolimages_3);
        TextView text4 = holder.getView(R.id.tv_kolimages_4);
        ImageView big = holder.getView(R.id.iv_kolimages_big);
        ImageView small = holder.getView(R.id.iv_kolimages_small);

        text1.setText(listBean.getSource());
        text2.setText(listBean.getTitle());
        text3.setText(listBean.getDescription());
        text4.setText(listBean.getSource_info().getSource_title());
        Glide.with(context).load(listBean.getThumb()).into(big);
        Glide.with(context).load(listBean.getSource_info().getSource_img()).into(small);
    }

    interface onItemListener {
        void onClick(int n);
    }
}
